#!/usr/bin/env python

from flask import Flask, request

app = Flask(__name__)


@app.route('/')
def root():
    return 'Welcome to the "Distributed Load Testing Using Kubernetes" sample web app\n'

# [START sample_app_endpoints]
@app.route('/login',  methods=['GET', 'POST'])
def login():
    deviceid = request.values.get('deviceid')
    return '/login - device: {}\n'.format(deviceid)

@app.route('/metrics',  methods=['GET', 'POST'])
def metrics():
    deviceid = request.values.get('deviceid')
    timestamp = request.values.get('timestamp')

    return '/metrics - device: {}, timestamp: {}\n'.format(deviceid, timestamp)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8000, debug=True)
